package cn.bugDance.test.domain.credit;

import cn.bugDance.domain.credit.model.entity.TradeEntity;
import cn.bugDance.domain.credit.model.valobj.TradeNameVO;
import cn.bugDance.domain.credit.model.valobj.TradeTypeVO;
import cn.bugDance.domain.credit.service.ICreditAccountAdjustService;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.concurrent.CountDownLatch;

@SpringBootTest
@RunWith(SpringRunner.class)
@Slf4j
public class testCreateOrder {

    @Resource
    private ICreditAccountAdjustService creditAccountAdjustService;

    @Test
    public void test_createOrder() throws InterruptedException {
        TradeEntity tradeEntity = new TradeEntity();
        tradeEntity.setUserId("yangxiaocan");
        tradeEntity.setBizId("853869112889");
        tradeEntity.setTradeAmount(200);
        tradeEntity.setTradeName(TradeNameVO.CONVERT_SKU);
        tradeEntity.setTradeType(TradeTypeVO.REVERSE);

        String orderId = creditAccountAdjustService.createOrder(tradeEntity);
        log.info("结果为: {}", orderId);
        new CountDownLatch(1).await();
    }
}
